package com.heima.article.controller;

import com.heima.article.service.ApArticleService;
import com.heima.model.common.dtos.CollectionBehaviorDto;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1")
@Slf4j
public class ApArticleBehaviorController {
    @Autowired
    private ApArticleService apArticleService;
    /**
     * 用户收藏行为
     */
    @PostMapping("/collection_behavior")
    @ApiOperation("用户的收藏行为")
    public ResponseResult collectionBehavior(@RequestBody CollectionBehaviorDto behaviorDto) {
        log.info("接收到收藏行为：{}", behaviorDto);
        return apArticleService.updateCollection(behaviorDto);
    }
}
